<?php

class Lib_CatchException
{
    public static function setErrorHandler()
    {
        //设置用户自定义的错误处理函数
        set_error_handler(function ($errno, $errstr, $errfile, $errline, array $errcontext) {
            // error was suppressed with the @-operator
            if (0 === error_reporting()) {
                return false;
            }
            throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
        }, E_WARNING);
    }
}
